<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>babel的配置的默认套路 | 个人博客 | 一个coder的成长记录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="babel">
    <meta name="description" content="babel的配置的默认套路 我是一个标题党，这篇文章介绍一点babel的默认配置套路，总结了一点遇到的项目管理问题。  babel的bug刺激了我 现象：项目编译没有任何问题，打开页面才报错 问题现象console报错：_objectSpread is not defined 原因：根据输出的错误，我猜测是babel的问题，因为_objectSpread就是使用了新的对象展开的语法...obj，编">
<meta name="keywords" content="babel">
<meta property="og:type" content="article">
<meta property="og:title" content="babel的配置的默认套路">
<meta property="og:url" content="https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/index.html">
<meta property="og:site_name" content="个人博客">
<meta property="og:description" content="babel的配置的默认套路 我是一个标题党，这篇文章介绍一点babel的默认配置套路，总结了一点遇到的项目管理问题。  babel的bug刺激了我 现象：项目编译没有任何问题，打开页面才报错 问题现象console报错：_objectSpread is not defined 原因：根据输出的错误，我猜测是babel的问题，因为_objectSpread就是使用了新的对象展开的语法...obj，编">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718201526.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718204821.jpg">
<meta property="og:image" content="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718231123.jpg">
<meta property="og:updated_time" content="2020-03-12T03:37:06.928Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="babel的配置的默认套路">
<meta name="twitter:description" content="babel的配置的默认套路 我是一个标题党，这篇文章介绍一点babel的默认配置套路，总结了一点遇到的项目管理问题。  babel的bug刺激了我 现象：项目编译没有任何问题，打开页面才报错 问题现象console报错：_objectSpread is not defined 原因：根据输出的错误，我猜测是babel的问题，因为_objectSpread就是使用了新的对象展开的语法...obj，编">
<meta name="twitter:image" content="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718201526.jpg">
    
        <link rel="alternate" type="application/atom+xml" title="个人博客" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide">
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">俊男</h5>
          <a href="mailto:betgar@163.com" title="betgar@163.com" class="mail">betgar@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/">
                <i class="icon icon-lg icon-home"></i>
                Home
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives">
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags">
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories">
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/betgar" target="_blank">
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://weibo.com/u/2296734915" target="_blank">
                <i class="icon icon-lg icon-weibo"></i>
                Weibo
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/about">
                <i class="icon icon-lg icon-link"></i>
                About
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">babel的配置的默认套路</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">babel的配置的默认套路</h1>
        <h5 class="subtitle">
            
                <time datetime="2019-07-15T05:00:00.000Z" itemprop="datePublished" class="page-time">
  2019-07-15
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/babel/">babel</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#babel的配置的默认套路"><span class="post-toc-number">1.</span> <span class="post-toc-text">babel的配置的默认套路</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#babel的bug刺激了我"><span class="post-toc-number">1.1.</span> <span class="post-toc-text">babel的bug刺激了我</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#babel的plugin和preset配置默认套路"><span class="post-toc-number">1.2.</span> <span class="post-toc-text">babel的plugin和preset配置默认套路</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#babel-v7"><span class="post-toc-number">1.2.1.</span> <span class="post-toc-text">babel v7</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#babel-v7-4支持core-js-3"><span class="post-toc-number">1.2.2.</span> <span class="post-toc-text">babel v7.4支持core-js@3</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#Plugin配置套路"><span class="post-toc-number">1.2.3.</span> <span class="post-toc-text">Plugin配置套路</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Plugin-路径"><span class="post-toc-number">1.2.3.1.</span> <span class="post-toc-text">Plugin 路径</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Plugin-简写-官方非常不推荐"><span class="post-toc-number">1.2.3.2.</span> <span class="post-toc-text">Plugin 简写(官方非常不推荐)</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Plugin执行顺序"><span class="post-toc-number">1.2.3.3.</span> <span class="post-toc-text">Plugin执行顺序</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Plugin-选项"><span class="post-toc-number">1.2.3.4.</span> <span class="post-toc-text">Plugin 选项</span></a></li></ol></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#preset配置套路"><span class="post-toc-number">1.2.4.</span> <span class="post-toc-text">preset配置套路</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Preset-路径"><span class="post-toc-number">1.2.4.1.</span> <span class="post-toc-text">Preset 路径</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Preset-简写-官方非常不推荐"><span class="post-toc-number">1.2.4.2.</span> <span class="post-toc-text">Preset 简写(官方非常不推荐)</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Preset执行顺序相反"><span class="post-toc-number">1.2.4.3.</span> <span class="post-toc-text">Preset执行顺序相反</span></a></li><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Preset-选项"><span class="post-toc-number">1.2.4.4.</span> <span class="post-toc-text">Preset 选项</span></a></li></ol></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#总结"><span class="post-toc-number">1.3.</span> <span class="post-toc-text">总结</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#参考"><span class="post-toc-number">1.4.</span> <span class="post-toc-text">参考</span></a></li></ol></li></ol>
        </nav>
    </aside>


<article id="post-babel-plugin-preset-default-configration" class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">babel的配置的默认套路</h1>
        <div class="post-meta">
            <time class="post-time" title="2019-07-15 13:00:00" datetime="2019-07-15T05:00:00.000Z" itemprop="datePublished">2019-07-15</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/babel/">babel</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style="display:none">
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="babel的配置的默认套路"><a href="#babel的配置的默认套路" class="headerlink" title="babel的配置的默认套路"></a>babel的配置的默认套路</h1><blockquote>
<p>我是一个标题党，这篇文章介绍一点babel的默认配置套路，总结了一点遇到的项目管理问题。</p>
</blockquote>
<h2 id="babel的bug刺激了我"><a href="#babel的bug刺激了我" class="headerlink" title="babel的bug刺激了我"></a>babel的bug刺激了我</h2><ul>
<li>现象：项目编译没有任何问题，打开页面才报错 问题现象console报错：<code>_objectSpread is not defined</code></li>
<li>原因：根据输出的错误，我猜测是babel的问题，因为<code>_objectSpread</code>就是使用了新的对象展开的语法<code>...obj</code>，编译之后才出现的。当然这里我也调试了编译后打代码。【如果你想看编译打包后代码，介绍一篇文章给你:   <a href="http://f2e.souche.com/blog/webpackbian-yi-vuexiang-mu-sheng-cheng-de-dai-ma-tan-suo/" target="_blank" rel="noopener">webpack编译vue项目生成的代码探索</a>】</li>
<li>分析：通过<code>git log</code>快速分析<code>package.json</code>的变更，发现只更新过<code>babel</code>相关。所以实锤是<code>babel</code>问题。</li>
</ul>
<p>分析<code>git log</code>时，我们当时做的<code>commit message style</code>统一的作用就发挥出来了，所有的工具链相关变更，统一都是<code>chore</code>开头，所以才能做到快速定位。顺便看看我们项目的<code>commit message</code></p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718201526.jpg" alt="commit message style" title>
                </div>
                <div class="image-caption">commit message style</div>
            </figure>
<ul>
<li><p>场景重现：<a href="https://babeljs.io/repl/version/7.4.4#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;spec=false&amp;loose=false&amp;code_lz=MYewdgzgLgBCCuUAOiDC4BmBLA5jAvDAN4wB05CyiMAvgNwBQoksz2ehJ5pOApmLwBOAQwA26MO1p0gA&amp;debug=false&amp;forceAllTransforms=true&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=false&amp;presets=&amp;prettier=false&amp;targets=&amp;version=7.1.6&amp;externalPlugins=%40babel%2Fplugin-proposal-object-rest-spread%407.5.3" target="_blank" rel="noopener">babel repl demo链接</a></p>
<p><img src="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718204821.jpg" alt></p>
</li>
</ul>
<blockquote>
<p>真实原因：对象展开的语法，babel编译之后注入了<code>_objectSpread</code>或者<code>_objectSpread2</code>函数来处理，维护的小伙伴没有把所有的分支都覆盖。修复这个issues的小伙伴也挺幽默，估计也是被折腾的够呛，说了一句玩笑话<strong>I’ll now go hiding myself somewhere and I won’t touch an helper for a few months 😆</strong></p>
<p>而且此bug是<code>babel v7.5.4</code>修复的，而且在低版本的<code>@babel/core</code>使用了高版本的<code>@babel/plugin-proposal-object-rest-spread</code>才能重现。</p>
<p><code>_objectSpread</code>官方issues相关链接：</p>
</blockquote>
<p><a href="https://github.com/babel/babel/issues/10179#issuecomment-509700433" target="_blank" rel="noopener">ReferenceError: _objectSpread is not defined after update</a>  </p>
<p><a href="https://github.com/babel/babel/issues/10187" target="_blank" rel="noopener">Missing helpers only throw once</a> </p>
<p><a href="https://github.com/babel/babel/pull/10188" target="_blank" rel="noopener">Fix _objectSpread2 for real</a></p>
<blockquote>
<p>找的问题的根源了，新问题来了，我怎么更新<code>@babel/core</code>呢？</p>
<p>因为不是项目直接依赖的<code>@babel/core</code>，而是其它工具依赖，我更新了也不一定起作用。</p>
</blockquote>
<p>介绍<code>npm</code>两个非常有用的命令：</p>
<ul>
<li><p>查看项目中安装的package版本和依赖关系</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">npm ls @babel/core</span><br><span class="line">`-- @vue/cli-plugin-babel@3.9.2</span><br><span class="line">  `-- @babel/core@7.5.4</span><br></pre></td></tr></table></figure>
<p>知道了依赖@babel/core是<code>@vue/cli-plugin-babel</code>，那升级<code>@vue/cli-plugin-babel</code>就行了。</p>
</li>
</ul>
<ul>
<li><p>查看<code>npm</code>仓库的package版本和依赖</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm show @babel/core</span><br></pre></td></tr></table></figure>
</li>
<li><p>推荐一个<code>npm-check</code>工具，专门用来更新依赖。</p>
<p><img src="https://raw.githubusercontent.com/betgar/betgar.github.io/master/img/picgo/20190718231123.jpg" alt="npm-check"></p>
<blockquote>
<p>可以执行<code>npm-check -u</code>来进行交互式选择更新，而且还列出了官方文档，可以直接看看release log之后再决定是否更新。</p>
</blockquote>
</li>
</ul>
<h2 id="babel的plugin和preset配置默认套路"><a href="#babel的plugin和preset配置默认套路" class="headerlink" title="babel的plugin和preset配置默认套路"></a><code>babel</code>的plugin和preset配置默认套路</h2><blockquote>
<p>本来我就比较懒，一直在计划学习的路上，基本都没落实行动。这次项目出现问题，我不得不去了解了一下，babel配置的那些套路。Babel的v7版本所有包都重命名了，所以还是要做到了解。</p>
</blockquote>
<h3 id="babel-v7"><a href="#babel-v7" class="headerlink" title="babel v7"></a>babel v7</h3><blockquote>
<p><a href="https://babel.docschina.org/docs/en/v7-migration" target="_blank" rel="noopener">官方升级文档链接</a></p>
<p>包含的内容太多，仔细过一遍才行，很多配置或者包名称命名规则都修改了。</p>
</blockquote>
<h3 id="babel-v7-4支持core-js-3"><a href="#babel-v7-4支持core-js-3" class="headerlink" title="babel v7.4支持core-js@3"></a><code>babel v7.4</code>支持<code>core-js@3</code></h3><blockquote>
<p>babel v7.4支持core-js@3，尤其是对<code>@babel/polyfill</code>和<code>@babel/preset-env</code>又带来了很多改变。</p>
</blockquote>
<ul>
<li><p>新的<code>corejs</code>配置项</p>
<blockquote>
<p>corejs配置项链接<a href="https://babeljs.io/docs/en/next/babel-preset-env#corejs" target="_blank" rel="noopener">options corejs</a></p>
</blockquote>
<p>当项目中的babel升级到v7.4+时会出现下面的警告：</p>
<blockquote>
<p>WARNING: We noticed you’re using the <code>useBuiltIns</code> option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the <code>corejs</code> option.</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 使用core-js@3的babel.config.js</span></span><br><span class="line"><span class="built_in">module</span>.exports = <span class="function"><span class="keyword">function</span> (<span class="params">api</span>) </span>&#123;</span><br><span class="line">    api.cache(<span class="literal">true</span>);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">const</span> presets =  [</span><br><span class="line">        [<span class="string">"@babel/preset-env"</span>,</span><br><span class="line">            &#123;</span><br><span class="line">            <span class="string">"useBuiltIns"</span>: <span class="string">"usage"</span>,</span><br><span class="line">            <span class="string">"corejs"</span>:<span class="number">3</span>, <span class="comment">// 指定版本</span></span><br><span class="line">            <span class="string">"targets"</span>:&#123;</span><br><span class="line">                <span class="string">"browsers"</span>:[<span class="string">"&gt; 1%"</span>, <span class="string">"last 2 versions"</span>, <span class="string">"not ie &lt;= 8"</span>]</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        ]</span><br><span class="line">    ];</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">        presets,</span><br><span class="line">        <span class="comment">// plugins</span></span><br><span class="line">    &#125;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>注意：</strong>把相应的core-js安装到项目依赖中，<code>npm i core-js@2</code> 或者<code>npm i core-js@3</code></p>
</li>
</ul>
<ul>
<li><p><code>@babel/polyfill</code>不支持从core-js2升级到core-js3，所以v7.4开始<code>@babel/polyfill</code>变成过时(deprecated)</p>
<blockquote>
<p>如果项目中使用core-js@3，则应该修改导入配置</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> <span class="string">"@babel/polyfill"</span>;</span><br></pre></td></tr></table></figure>
<p>替换为：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> <span class="string">"core-js/stable"</span>;</span><br><span class="line"><span class="keyword">import</span> <span class="string">"regenerator-runtime/runtime"</span>;</span><br></pre></td></tr></table></figure>
<p>直接安装依赖到项目：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i --save core-js regenerator-runtime</span><br></pre></td></tr></table></figure>
</li>
</ul>
<blockquote>
<p>因为babel和core-js绑定的很紧密，所以推荐看一下core-js作者的文章：<a href="https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md" target="_blank" rel="noopener">core-js-3-babel-and-a-look-into-the-future</a>详细介绍了core-js@3版本带来的改变，以及解决的问题。</p>
</blockquote>
<h3 id="Plugin配置套路"><a href="#Plugin配置套路" class="headerlink" title="Plugin配置套路"></a>Plugin配置套路</h3><blockquote>
<p>syntax plugins允许babel去parse特定的类型的syntax而不是去转换变形（transform）</p>
<p>注意：transform plugins会自动启用syntax plugins。 因此，如果已经使用了相应的transform plugins，则无需指定syntax plugins。</p>
</blockquote>
<h4 id="Plugin-路径"><a href="#Plugin-路径" class="headerlink" title="Plugin 路径"></a>Plugin 路径</h4><p>如果 plugin 在 npm 上，你可以传入预设名称，babel 将检查它是否已安装在 <code>node_modules</code> 中</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [<span class="string">"babel-plugin-myPlugin"</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>还可以指定的相对/绝对路径。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [<span class="string">"./node_modules/asdf/plugin"</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="Plugin-简写-官方非常不推荐"><a href="#Plugin-简写-官方非常不推荐" class="headerlink" title="Plugin 简写(官方非常不推荐)"></a>Plugin 简写(官方非常不推荐)</h4><p>如果包的名称以 <code>babel-plugin-</code> 为前缀，可以使用简写：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [</span><br><span class="line">    <span class="string">"myPlugin"</span>,</span><br><span class="line">    <span class="string">"babel-plugin-myPlugin"</span> <span class="comment">// equivalent</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这也适用于 scoped 包：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [</span><br><span class="line">    <span class="string">"@org/babel-plugin-name"</span>,</span><br><span class="line">    <span class="string">"@org/name"</span> <span class="comment">// equivalent</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="Plugin执行顺序"><a href="#Plugin执行顺序" class="headerlink" title="Plugin执行顺序"></a>Plugin执行顺序</h4><blockquote>
<p>如果两个transforms都访问“程序”节点，则transforms将以plugin或preset顺序运行。</p>
<ul>
<li>plugin在preset之前运行。</li>
<li>plugin执行顺序是第一个到最后一个。</li>
<li>preset顺序相反（从最后到第一个）。</li>
</ul>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [<span class="string">"transform-decorators-legacy"</span>, <span class="string">"transform-class-properties"</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>先执行<code>transform-decorators-legacy</code>后<code>transform-class-properties</code></p>
<h4 id="Plugin-选项"><a href="#Plugin-选项" class="headerlink" title="Plugin 选项"></a>Plugin 选项</h4><blockquote>
<p>plugins和 presets 都可以通过将名称和选项对象放在配置中的数组中来指定选项。</p>
<p>对于不指定选项，这些都是等同的：</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [<span class="string">"pluginA"</span>, [<span class="string">"pluginA"</span>], [<span class="string">"pluginA"</span>, &#123;&#125;]]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>要指定选项，请使用选项名称作为 key 传递对象。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"plugins"</span>: [</span><br><span class="line">    [</span><br><span class="line">      <span class="string">"transform-async-to-module-method"</span>,</span><br><span class="line">      &#123;</span><br><span class="line">        <span class="string">"module"</span>: <span class="string">"bluebird"</span>,</span><br><span class="line">        <span class="string">"method"</span>: <span class="string">"coroutine"</span></span><br><span class="line">      &#125;</span><br><span class="line">    ]</span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="preset配置套路"><a href="#preset配置套路" class="headerlink" title="preset配置套路"></a>preset配置套路</h3><blockquote>
<p>preset是一个插件数组</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">module</span>.exports = <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="keyword">return</span> &#123;</span><br><span class="line">    plugins: [</span><br><span class="line">      <span class="string">"pluginA"</span>,</span><br><span class="line">      <span class="string">"pluginB"</span>,</span><br><span class="line">      <span class="string">"pluginC"</span>,</span><br><span class="line">    ]</span><br><span class="line">  &#125;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>Presets 可以包含其他的 presets 以及带有选项的插件。</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">module</span>.exports = <span class="function"><span class="params">()</span> =&gt;</span> (&#123;</span><br><span class="line">  presets: [</span><br><span class="line">    <span class="built_in">require</span>(<span class="string">"@babel/preset-env"</span>),</span><br><span class="line">  ],</span><br><span class="line">  plugins: [</span><br><span class="line">    [<span class="built_in">require</span>(<span class="string">"@babel/plugin-proposal-class-properties"</span>), &#123; <span class="attr">loose</span>: <span class="literal">true</span> &#125;],</span><br><span class="line">    <span class="built_in">require</span>(<span class="string">"@babel/plugin-proposal-object-rest-spread"</span>),</span><br><span class="line">  ],</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h4 id="Preset-路径"><a href="#Preset-路径" class="headerlink" title="Preset 路径"></a>Preset 路径</h4><p>如果 preset 在 npm 上，你可以传入预设名称，babel 将检查它是否已安装在 <code>node_modules</code> 中</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [<span class="string">"babel-preset-myPreset"</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>还可以指定 presets 的相对/绝对路径。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [<span class="string">"./myProject/myPreset"</span>]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="Preset-简写-官方非常不推荐"><a href="#Preset-简写-官方非常不推荐" class="headerlink" title="Preset 简写(官方非常不推荐)"></a>Preset 简写(官方非常不推荐)</h4><p>如果包的名称以 <code>babel-preset-</code> 为前缀，可以使用简写：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [</span><br><span class="line">    <span class="string">"myPreset"</span>,</span><br><span class="line">    <span class="string">"babel-preset-myPreset"</span> <span class="comment">// 等同</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这也适用于 scoped 包：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [</span><br><span class="line">    <span class="string">"@org/babel-preset-name"</span>,</span><br><span class="line">    <span class="string">"@org/name"</span> <span class="comment">// 等同</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// vue-cli生成的babel.config.js</span></span><br><span class="line"><span class="built_in">module</span>.exports = &#123;</span><br><span class="line">  presets: [</span><br><span class="line">    [</span><br><span class="line">      <span class="string">'@vue/app'</span>, <span class="comment">// 对应 @vue/babel-preset-app,当时害的我找来找去都没找到包</span></span><br><span class="line">      &#123;</span><br><span class="line">        useBuiltIns: <span class="string">'entry'</span>,</span><br><span class="line">        corejs: <span class="number">2</span>, <span class="comment">// @see https://babeljs.io/docs/en/babel-preset-env#corejs</span></span><br><span class="line">      &#125;,</span><br><span class="line">    ],</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<h4 id="Preset执行顺序相反"><a href="#Preset执行顺序相反" class="headerlink" title="Preset执行顺序相反"></a>Preset执行顺序相反</h4><blockquote>
<p>Preset 的顺序是相反的(从最后一个到第一个).</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [</span><br><span class="line">    <span class="string">"a"</span>,</span><br><span class="line">    <span class="string">"b"</span>,</span><br><span class="line">    <span class="string">"c"</span></span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>将会按照以下顺序运行：<code>c</code>, <code>b</code>, 然后 <code>a</code>。</p>
<h4 id="Preset-选项"><a href="#Preset-选项" class="headerlink" title="Preset 选项"></a>Preset 选项</h4><blockquote>
<p>插件和 presets 都可以通过将名称和选项对象放在配置中的数组中来指定选项。</p>
<p>对于不指定选项，这些都是等同的：</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [</span><br><span class="line">    <span class="string">"presetA"</span>,</span><br><span class="line">    [<span class="string">"presetA"</span>],</span><br><span class="line">    [<span class="string">"presetA"</span>, &#123;&#125;],</span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>要指定选项，请使用选项名称作为 key 传递对象。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="string">"presets"</span>: [</span><br><span class="line">    [<span class="string">"@babel/preset-env"</span>, &#123;</span><br><span class="line">      <span class="string">"loose"</span>: <span class="literal">true</span>,</span><br><span class="line">      <span class="string">"modules"</span>: <span class="literal">false</span></span><br><span class="line">    &#125;]</span><br><span class="line">  ]</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><blockquote>
<p>前端的知识链太长，技术更新越来越快。前端的投资风险还是很大，所以谨慎选择框架，分配一点时间投资在业界公认的工具上也是不错的，例如：webpack, babel, vs code, scss等。这些都是现代前端工程的构建工具，所以生命周期会比某一个框架更长远。</p>
</blockquote>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><p><a href="https://github.com/jamiebuilds/babel-handbook/blob/master/translations/zh-Hans/plugin-handbook.md" target="_blank" rel="noopener">babel-plugin-handbook</a></p>
<p><a href="https://github.com/jamiebuilds/babel-handbook/blob/master/translations/zh-Hans/user-handbook.md" target="_blank" rel="noopener">babel-user-handbook</a></p>
<p><a href="https://github.com/babel/babel/issues/10179#issuecomment-510080288" target="_blank" rel="noopener">强制jest使用新的babel</a></p>
<p><a href="https://babeljs.io/docs/en/next/babel-preset-env#corejs" target="_blank" rel="noopener">options corejs</a></p>
<p><a href="https://segmentfault.com/a/1190000019718925" target="_blank" rel="noopener">Babel 7使用总结</a></p>
<p><a href="https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md" target="_blank" rel="noopener">core-js-3-babel-and-a-look-into-the-future</a></p>
<p><a href="https://github.com/babel/babel-preset-env" target="_blank" rel="noopener">babel-preset-env官方仓库</a></p>
<p><a href="https://www.cnblogs.com/itlkNote/p/6830682.html" target="_blank" rel="noopener">npm 常用命令详解</a></p>
<p><a href="https://www.sitepoint.com/beginners-guide-node-package-manager" target="_blank" rel="noopener">A Beginner’s Guide to npm — the Node Package Manager</a></p>

        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-03-12T03:37:06.928Z" itemprop="dateUpdated">2020-03-12 11:37:06</time>
</span><br>


        
        原文链接：<a href="/2019/07/15/babel-plugin-preset-default-configration/" target="_blank" rel="external">https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/</a>
        
    </div>
    
    <footer>
        <a href="https://betgar.github.io">
            <img src="/img/avatar.jpg" alt="俊男">
            俊男
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/babel/">babel</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&title=《babel的配置的默认套路》 — 个人博客&pic=https://betgar.github.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&title=《babel的配置的默认套路》 — 个人博客&source=各种技术加身的coder" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《babel的配置的默认套路》 — 个人博客&url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&via=https://betgar.github.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2019/07/29/typescript-and-babel-7/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">TypeScript 和 Babel 7</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2019/07/15/learn-babel-guide/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">babel的配置的默认套路</h4>
      </a>
    </div>
  
</nav>



    











    <!-- Valine Comments -->
    <div class="comments vcomment" id="comments"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script>
    <!-- Valine Comments script -->
    <script>
        var GUEST_INFO = ['nick','mail','link'];
        var guest_info = 'nick,mail,link'.split(',').filter(function(item){
          return GUEST_INFO.indexOf(item) > -1
        });
        new Valine({
            el: '#comments',
            notify: 'false' == 'true',
            verify: 'false' == 'true',
            appId: "kiGWA9mdoVtQlfGYA5uDBNX7-gzGzoHsz",
            appKey: "dHCOdD0oEIjJd0cJoAHHN0y3",
            avatar: "mm",
            placeholder: "Just comment it",
            guest_info: guest_info.length == 0 ? GUEST_INFO : guest_info,
            pageSize: "10"
        })
    </script>
    <!-- Valine Comments end -->







</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style="display:none">
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style="display:none">
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>俊男 &copy; 2017 - 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&title=《babel的配置的默认套路》 — 个人博客&pic=https://betgar.github.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&title=《babel的配置的默认套路》 — 个人博客&source=各种技术加身的coder" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《babel的配置的默认套路》 — 个人博客&url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/&via=https://betgar.github.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://betgar.github.io/2019/07/15/babel-plugin-preset-default-configration/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
